home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / ShipBossLaserB.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.2 KB  |  86 lines

  1. class classes.shots.ShipBossLaserB
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var speed;
  8.    var color;
  9.    var clip;
  10.    var xMov = 0;
  11.    var yMov = 0;
  12.    var Name = "shipBossLaserB";
  13.    var power = 20;
  14.    var yank = false;
  15.    function ShipBossLaserB(px, py, pcolor, pDir, pspeed, pid)
  16.    {
  17.       this.x = px;
  18.       this.y = py;
  19.       this.id = pid;
  20.       this.dir = pDir;
  21.       this.speed = pspeed;
  22.       this.color = pcolor;
  23.       _root.d = _root.d + 1;
  24.       this.clip = _root.attachMovie("shipBossLaserB","shipBossLaserB" + this.id + "Clip",_root.d);
  25.       this.clip._x = this.x;
  26.       this.clip._y = this.y;
  27.       this.clip.id = this.id;
  28.       if(this.dir == "UL")
  29.       {
  30.          this.xMov = -1 * this.speed;
  31.          this.yMov = -0.66 * this.speed;
  32.          this.x += this.speed;
  33.          this.y += 0.66 * this.speed;
  34.       }
  35.       else if(this.dir == "DL")
  36.       {
  37.          this.xMov = -1 * this.speed;
  38.          this.yMov = 0.66 * this.speed;
  39.          this.x += this.speed;
  40.          this.y -= 0.66 * this.speed;
  41.       }
  42.       else if(this.dir == "UR")
  43.       {
  44.          this.xMov = this.speed;
  45.          this.yMov = -0.66 * this.speed;
  46.          this.x -= this.speed;
  47.          this.y += 0.66 * this.speed;
  48.       }
  49.       else if(this.dir == "DR")
  50.       {
  51.          this.xMov = this.speed;
  52.          this.yMov = 0.66 * this.speed;
  53.          this.x -= this.speed;
  54.          this.y -= 0.66 * this.speed;
  55.       }
  56.       this.clip.gotoAndStop(this.color + this.dir);
  57.    }
  58.    function hit()
  59.    {
  60.       this.yank = true;
  61.    }
  62.    function main()
  63.    {
  64.       this.xMov *= 1.02;
  65.       this.yMov *= 1.02;
  66.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  67.       {
  68.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  69.          this.yank = true;
  70.       }
  71.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  72.       {
  73.          this.yank = true;
  74.       }
  75.       if(this.yank)
  76.       {
  77.          _root.removeEnemyShot("shipBossLaserB" + this.id);
  78.          this.yank = false;
  79.       }
  80.       this.x += this.xMov;
  81.       this.y += this.yMov;
  82.       this.clip._x = this.x;
  83.       this.clip._y = this.y;
  84.    }
  85. }
  86.